#ifndef UTILITY_INCLUDED
#define UTILITY_INCLUDED

#pragma once

#include <string>	// std::string
#include <sstream>	// std::stringstream

#include <d3d11.h>	// HRESULT

namespace Utility
{
	template <typename To>
	std::string ToString(To value)
	{
		std::stringstream out;
		out << value;
		return out.str();
	}

	namespace Error
	{
		inline void CheckDXError(HRESULT result, const std::string& operation)
		{
			if(FAILED(result))
				throw std::runtime_error("[DX-Error] Operation '" + operation + "' failed with result '" + Utility::ToString(result) + "'");
		}
	}
}

#endif